{% extends 'IcsocUIBundle::base.html.twig' %}
{% block content %}
    <div>
        <input type="button" name="bootbox" id="some-button1" value="点击1" />
        <input type="button" name="bootbox" id="some-button2" value="点击2" />
        <input type="button" name="bootbox" id="some-button3" value="点击3" />
    </div>
{% endblock %}
{% block footer %}
    {% javascripts
    '@bootbox_js'
    filter='uglifyjs'
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        $("#some-button1").on('click', function() {
            bootbox.dialog({
                message: "I am a custom dialog with custom buttons",
                buttons:
                {
                    "success" :
                    {
                        "label" : "<i class='ace-icon fa fa-check'></i> Success!",
                        "className" : "btn-sm btn-success",
                        "callback": function() {
                            //clicked, do something
                        }
                    },
                    "danger" :
                    {
                        "label" : "Danger!",
                        "className" : "btn-sm btn-danger",
                        "callback": function() {
                            //clicked, do something
                        }
                    }
                }
            })
        })
        $('#some-button2').on('click', function() {
            bootbox.confirm('Are you sure?', function(result) {
                if(result) {
                    //do something
                }
            })
        })
        $("#some-button3").on('click', function() {
            bootbox.confirm({
                message: "Are you sure?",
                buttons: {
                    confirm: {
                        label: "OK",
                        className: "btn-primary btn-sm",
                    },
                    cancel: {
                        label: "Cancel",
                        className: "btn-sm",
                    }
                },
                callback: function(result) {
                    //if(result) do something;
                }
            });
        });
    </script>
{% endblock %}